
<!DOCTYPE html>
<html class="client-nojs" lang="en" dir="ltr">
<head>
<meta charset="UTF-8"/>
<title>Pto var - PanoTools.org Wiki</title>




<style media="screen" type="text/css" title="Screen style sheet"> @import url(manual.css); </style>

<meta name="generator" content="MediaWiki 1.35.3"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>





<!--[if lt IE 9]><![endif]-->
</head>
<body class="mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Pto_var rootpage-Pto_var skin-vector action-view skin-vector-legacy">


<div id="content" class="mw-body" role="main">
	<a id="top"></a>
	
	
	<h1 id="firstHeading" class="firstHeading" lang="en">Pto var</h1>
	<div id="bodyContent" class="mw-body-content">
		<div id="siteSub" class="noprint">From PanoTools.org Wiki</div>
		
		
		
		
		
		
		<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><div class="mw-parser-output"><p><b>Pto_var</b> can manipulate image variables in <a href="Hugin.html" title="Hugin">Hugin</a> .pto project files. The intended use of Pto_var is in <a href="Panorama_scripting_in_a_nutshell.html" title="Panorama scripting in a nutshell">Scripting</a>. Pto_var can set image variables to a given value, it can change the link status and it can mark variables for <a href="Optimization.html" title="Optimization">optimisation</a>.
</p><p>The general use is:
</p>
<pre>   pto_var [switches] --output=output.pto --opt|--link|--unlink|--set|--set-from-file images input.pto
</pre>
<h2><a name="Optimisation_variables"><span class="mw-headline">Optimisation variables</span></a></h2>
<p><b>Pto_var</b> can mark image variables for <a href="Optimization.html" title="Optimization">optimisation</a>. (This information is stored in the v lines in the pto file.) This information is  used by <a href="Autooptimiser.html" title="Autooptimiser">autooptimiser</a> and <a href="Vig_optimize.html" title="Vig optimize">vig_optimize</a> to do the actual optimisation.
</p><p>Running without other switches will only mark the variables given on the command line for optimisation. If you want to modify the marked variables add <b>--modify-opt</b> to the command line.
</p><p>The usage is:
</p>
<pre>  pto_var --opt="image variables list" input.pto
</pre>
<p>The image variable list consist of a comma separated list of image variables: 
</p>
<pre>   [!]name[image number]
</pre>
<p>The following image variables are allowed:
</p>
<ul><li>position: y, p, r, TrX, TrY, TrZ, Tpy, Tpp</li>
<li>lens parameters: v, a, b, c, d, e, g, t</li>
<li>photometric parameters: Eev, Er, Eb, Vb, Vc, Vd, Vx, Vy, Ra, Rb, Rc, Rd, Re (Vignetting and response parameter will treated as group.)</li></ul>
<p>The image numbers start with zero. If no number is given, the variables will be applied to all images. (In this case a special treatment applies to the position of the anchor image.)
</p><p>An exclamation mark before the variable will remove the variable from the list of variables to optimised.
</p><p>Examples:
</p>
<ul><li><b>--opt=y,p,r</b> will optimize position for all images.</li>
<li><b>--opt=v,!v0</b> will optimize field of view for all images except the first.</li>
<li><b>--opt=Vb1,Ra1</b> will optimize <a href="Vignetting.html" title="Vignetting">vignetting</a> and <a href="Camera_response_curve.html" title="Camera response curve">response curve</a> for the second image.</li>
<li><b>--modify-opt --opt=!v</b> will not optimize field of view.</li></ul>
<h2><a name="Link_or_unlink_image_variables"><span class="mw-headline">Link or unlink image variables</span></a></h2>
<p>To modify the link status of an image variable use <b>--link</b> or <b>-unlink</b>. Supply a list of comma separated image variables with corresponding image number.
</p><p>Examples:
</p>
<ul><li><b>--link=v3</b> will link field of view of image 3.</li>
<li><b>--link=a1,b1,c1</b> will link lens distortion for second image.</li>
<li><b>--unlink=v0</b> will unlink field of view for the first image.</li>
<li><b>--unlink=Vb3,Ra3</b> will unlink <a href="Vignetting.html" title="Vignetting">vignetting</a> and <a href="Camera_response_curve.html" title="Camera response curve">response curve</a> for image 3.</li></ul>
<h2><a name="Set_image_variables"><span class="mw-headline">Set image variables</span></a></h2>
<p>With this switch you can set the image variable to the given value. This applies to all the image variables of that sort or only to a single image, when the image number is given.
</p><p>Examples:
</p>
<ul><li><b>--set=y=0,p=0,r=0</b> will reset all image positions.</li>
<li><b>--set=a1=0,b1=-0.05,c1=0</b> will set the lens distortion parameters for the second image.</li></ul>
<p>You can also give a mathematical expression. Supported are:
</p>
<ul><li>the operators +-*/% and ^ (addition, subtraction, multiplication, division, modulo and exponentiation),</li>
<li>parentheses,</li>
<li>the functions <i>abs, sin, cos, tan, asin, acos, atan, exp, ceil, floor</i> and <i>sqrt</i> (trigonometric functions use the angle in radians),</li>
<li>the constant <i>pi</i> and the functions <i>deg</i> and <i>rad</i> to convert to degrees or radians,</li>
<li>the constant <i>i</i> holds the image number,</li>
<li>the constant <i>val</i> contains the old value,</li>
<li>the constants <i>hfov</i>, <i>width</i> and <i>height</i> contains the horizontal field of view, the image width and the image height of the current image,</li>
<li>a if statement: <i>x?y:z</i>. For the comparison statement you can use &lt;, &gt;, &lt;=, &gt;=, == (equal) and&#160;!= (not equal)</li>
<li>since 2018.2: access to all image variables with the panotools syntax: e.g. <i>y1</i> is the yaw value of the second image (These constants contains the values of the panorama when the parser is started. They don't change when you modify them in between.)</li></ul>
<p>The expression should return exactly one value. It may be necessary to quote the string to correctly get the special characters read.
</p><p>See some examples:
</p>
<ul><li><b>--set=y1=val+10</b> will increase yaw of the second image by 10 degrees.</li>
<li><b>--set=r2=val-90</b> will decrease the roll angle of third image by 90 degrees.</li>
<li><b>--set=v=1.1*val</b> will increase field of view for all images by 10&#160;%.</li>
<li><b>--set=Er=val/1.1,Eb=val/1.2</b> will divide the red multiplier by 1.1, and the blue multiplier by 1.2 respective for all images.</li>
<li><b>--set=y=i*90,p=-1^i*20,r=0</b> a more complicated example for a fisheye panorama, sets yaw, pitch and roll</li>
<li><b>--set="r=i&lt;4?val+45:val"</b> rotate the first 3 images by 45 degree individual (note: quoting for Windows)</li></ul>
<p>You can also read the string from a text file. Use
</p>
<pre>  pto_var --set-from-file filename --output=output.pto project.pto
</pre>
<p>In the text file the individual variables can be separated by comma or a line break.
</p>
<h2><a name="Crop"><span class="mw-headline">Crop</span></a></h2>
<p>You can change the crop of images in the pto file with pto_var. There are several variants possible, depending on the use case
</p>
<ul><li><b>--crop=left,right,top,bottom</b> Sets the crop for all images to the given coordinates.</li>
<li><b>--crop=width,height</b> Sets the crop for all images to the given width and height and activates autocenter for crop. Relative values for width and height can be used with&#160;%, e.g. <b>--crop=90%,80%</b></li>
<li><b>--crop=iNUM=left,right,top,bottom</b> Sets the crop for image NUM to the given coordinates.</li>
<li><b>--crop=iNUM=width,height</b>  Sets the crop for image NUM to the given width and height and activate autocenter for crop.</li></ul>
<p>The switches which refers to single images can be used several times and set the crop for several images in one go.
</p>
<h2><a name="Anchor"><span class="mw-headline">Anchor</span></a></h2>
<p>For geometric and photometric optimisation one image is used as anchor. The image which is used as anchor can be set with <b>--anchor=NUM</b> for the geometric optimisation and with <b>--color-anchor=NUM</b> for the photometric optimisation.
</p>
<h2><a name="General_options"><span class="mw-headline">General options</span></a></h2>
<ul><li><b>-o|--output output.pto</b> Output a pto file with the given filename. If not given it will append "_var" to the input filename.</li>
<li><b>-h | --help</b> Display help.</li></ul>

<!--
Transclusion expansion time report (%,ms,calls,template)
100.00%    0.000      1 -total
-->


</div></div><div class="printfooter">Retrieved from "<a dir="ltr" href="https://wiki.panotools.org/index.php?title=Pto_var&amp;oldid=16229">https://wiki.panotools.org/index.php?title=Pto_var&amp;oldid=16229</a>"</div>
		</div></div></body></html>